package net.jonbuck.tassoo.eventmanager.events;

import net.jonbuck.tassoo.model.Task;
import net.jonbuck.tassoo.eventmanager.exception.UnsupportedListenerException;
import net.jonbuck.tassoo.eventmanager.listener.TaskEventListener;


/**
 * 
 * 
 * @since 1.0.0
 */
public class TaskCreatedEvent implements TassooEvent {

	/** ... */
	private Task task;

	/**
	 * 
	 * @param task
	 */
	public TaskCreatedEvent(Task task) {
		super();
		this.task = task;
	}

	/**
	 * 
	 */
	public void dispatchEvent(Object listener) {
		if (listener instanceof TaskEventListener) {
			final TaskEventListener eventListener = (TaskEventListener) listener;
			eventListener.processTaskCreatedEvent(task);
		} else {
			throw new UnsupportedListenerException("001", "Blah");
		}
	}

}
